{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将 python代码转换为C++\n",
    "%pip install pythran\n",
    "# py 转 hpp\n",
    "!pythran   -e cli_foo.py   -p pythran.optimizations.ConstantFolding   -o cli_foo.hpp\n",
    "# cpp 编译 二进制\n",
    "!'pythran-config  --compiler --cflags'  -std=c++11  cli_foo.cpp -o cli_foo\n",
    "# 运行\n",
    "!./ cli_foo"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  },
  "vscode": {
   "interpreter": {
    "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
